<?php
namespace Cmf\Forms;

use Phalcon\Forms\Form;
use Phalcon\Forms\Element\Text;
use Phalcon\Forms\Element\Password;
use Phalcon\Forms\Element\Submit;
use Phalcon\Forms\Element\Check;
use Phalcon\Forms\Element\Hidden;
use Phalcon\Validation\Validator\PresenceOf;
use Phalcon\Validation\Validator\Email;
use Phalcon\Validation\Validator\Identical;

class SignInForm extends Form
{
    public function initialize()
    {
        /*登录邮箱*/
        $email = new Text('email', ['placeholder' => 'Email']);
        $email->addValidators([
            new PresenceOf([
                'message' => '请输入登录邮箱'
            ]),
            new Email([
                'message' => '登录邮箱格式不正确'
            ])
        ]);
        $this->add($email);

        /*登录密码*/
        $password = new Password('password', ['placeholder' => 'Password']);
        $password->addValidator(new PresenceOf(['message' => 'The password is required']));
        $this->add($password);

        /*记住密码*/
        $rememberMe = new Check('remember-me');
        $this->add($rememberMe);

        /*提交按钮*/
        $submit = new Submit('submit', ['class' => 'am-btn am-btn-primary am-btn-sm am-fl', 'value' => '登 录']);
        $this->add($submit);

    }
}
